﻿using System;

namespace Foreglance.MVP.Factories
{
    public abstract class AbstractFactory: IAbstractFactory
    {
        public T Create<T>()
        {
            var factory = this as IFactory<T>;
            if (factory != null) 
                return factory.Create();
            throw new InvalidOperationException(string.Format("Type {0} is not supported", typeof(T)));
        }
    }
}
